#ifndef __AS_TEXTVIEW__H__
#define __AS_TEXTVIEW__H__

#include "ASControl.h"
#include "ASLabel.h"
#include "ASScrollBar.h"

typedef struct
{
    /* base */
    as_control base;

    /* attributes */
    as_label* label;
    as_scrollbar* sb;
    ASINT text_total_height;
    as_point last_pos;
    ASINT is_taped, is_moved;
    ASBOOL if_show_scrollbar;
    /* methods */

    /*
     *	[description] change text of the text view
     *  [param] ctrl_p : which control
     *  [param] text : target text
     *  [return] as_ret : result
     */
    as_ret (*change_text)(as_control* ctrl_p, ASWSTR text);

    /*
     *	[description] set color of the text
     *  [param] ctrl_p : which control
     *  [param] color : value as 0xrrggbb
     *  [return] as_ret : result
     */
    as_ret (*set_text_color)(as_control* ctrl_p, ASUINT color);

    /*
     *	[description] background color of the text view
     *  [param] ctrl_p : which control
     *  [param] color : value as 0xrrggbb
     *  [return] as_ret : result
     */
    as_ret (*set_bg_color)(as_control* ctrl_p, ASUINT color);

    /*
     *	[description] background frame color of the text view
     *  [param] ctrl_p : which control
     *  [param] color : value as 0xrrggbb
     *  [return] as_ret : result
     */
    as_ret (*set_bg_frame_color)(as_control* ctrl_p, ASUINT color);

    /*
     *	[description] if show scroll bar
     *  [param] ctrl_p : which control
     *  [param] if_show : flag of if show
     *  [return] as_ret : result
     */
    as_ret (*set_sb_show)(as_control* ctrl_p, ASBOOL if_show);

    /*
     *	[description] if show as small font
     *  [param] ctrl_p : which control
     *  [param] if_show : flag of if small
     *  [return] as_ret : result
     */
    as_ret (*set_if_small)(as_control* ctrl_p, ASBOOL if_small);

    /*
     *	[description] set scroll bar images , you should firstly use set_sb_show to set scrollbar could show.
     *  [param] ctrl_p : which control
     *  [param] tail_path : tail image
     *  [param] tile_path : tile image
     *  [param] type : image source type
     *  [return] as_ret : result
     */
    as_ret (*set_sb_img)(as_control* ctrl_p, ASWSTR tail_path, ASWSTR tile_path, as_image_src_type type);

    /*
     *	[description] set scroll bar filled color , you should firstly use set_sb_show to set scrollbar could show.
     *  [param] ctrl_p : which control
     *  [param] color : which color to fill the scroll bar
     *  [return] as_ret : result
     */
    as_ret (*set_sb_color)(as_control* ctrl_p, ASUINT color);

} as_textview;


as_textview* as_ctrl_textview_create(as_rect area, ASWSTR text);


as_ret as_ctrl_textview_destroy(as_textview* ctrl_label_p);




#endif//__AS_TEXTVIEW__H__